<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>CSS3选择器</title>
    <style>
        /*ul:nth-child(1){
            background:red;
        }
        ul:nth-child(2){
            background:green;
        }*/
        /*ul:nth-child(1) li:nth-child(odd){
            background:red;
        }
        ul:nth-child(1) li:nth-child(even){
            background:green;
        }
        ul:nth-child(2) li:nth-child(4n+1){
            background:blue;
        }*/
        /*ul:nth-child(2) li:nth-child(2n+5){
            background:blue;
        }*/

        /*ul:nth-last-child(1) li:nth-last-child(3){
            background:blue;
        }*/
        /*ul:nth-last-child(1) li:nth-last-child(-n+5){
            background:blue;
        }
        span:only-child{
            background:red;
        }*/
        ul:nth-of-type(1) li:nth-of-type(3n+5){
            background:red;
        }
        /*ul:nth-last-of-type(1) li:nth-last-of-type(-n+4){
            background:red;
        }*/
    </style>
</head>
<body>
    <div>我是DIV</div>
    <ul>
        <li>项目1</li>
        <li>项目2</li>
        <li>项目3</li>
        <li>项目4</li>
        <li>项目5</li>
        <li>项目6</li>
        <li>项目7</li>
        <li>项目8</li>
        <li>项目9</li>
        <li>项目10</li>
    </ul>
    <ul>
        <li>列表1</li>
        <li>列表2</li>
        <li>列表3</li>
        <li>列表4</li>
        <li>列表5</li>
        <li>列表6</li>
        <li>列表7</li>
        <li>列表8</li>
        <li>列表9</li>
        <li>列表10</li>
    </ul>
    <div><span>span标签</span><p>2</p></div>
</body>
</html>
